﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace DataAccess
{
    public class ErrorLog
    {
        //Next error id 109


        /// <summary>
        /// Logs a error to the eventlog
        /// </summary>
        /// <param name="source">Source of the error</param>
        /// <param name="log">The log to write to</param>
        /// <param name="text">The text for the log</param>
        /// <param name="id">The id of the log entry, used to see where the error occured</param>
        /// <param name="type">The type of the event usualy error</param>
        public static void LogEvent(string source, string log, string text, int id, EventLogEntryType type)
        {
            if (!EventLog.SourceExists(source))
                EventLog.CreateEventSource(source, log);

            EventLog.WriteEntry(source, text, type, id); 

        }
    }
}
